package com.sunyw.xyz.model;

import lombok.Data;

/**返回结果
 * @author zengg
 */
@Data
public class Result<T>{

    private  String msg;
    private  Integer code;
    private T data;

    public Result<T> ok(T t){
        this.msg="成功";
        this.code=0;
        this.data=t;
        return this;
    }

    public Result<T> fail(T t){
        this.msg="失败";
        this.code=-1;
        this.data=t;
        return this;
    }

    public Result<T> fail(T t,Integer code,String msg){
        this.msg=msg;
        this.code=code;
        this.data=t;
        return this;
    }
}
